1. Field of the Invention
The present invention generally relates to object oriented programming (OOP) systems, and, more particularly, to OOP systems supporting the C++ programming language.
2. Background Description
The C++ programming language provides a number of features such as classes, inheritance, multiple inheritance, and virtual inheritance. These object oriented features have several advantages. Most importantly they enable the creation of class libraries that can be reused in several different applications. However, such code reuse comes at a price. To enable reusability, object oriented programming encourages the use of classes that incorporate a high degree of functionality. Programs that use such classes, however, may pay a penalty for functions they do not use. One of the resulting penalties is that of increased code size resulting from linking unused functions. The prior art has focused on addressing this penalty. An example of such prior art is A. Srivastava, "Unreachable procedures in object oriented programing", ACM Letters on Programming Languages and Systems, 1(4), pp. 355-364, December 1992.
Other prior art has focused on determining unused code at the statement level. In particular, program slicing techniques have been developed for isolating computational threads in programs. A program slice is generally defined as the set of statements that either contribute to, or are affected by, the values computed at some designated point of interest in the program. A more detailed description of program slicing may be found in F. Tip, "A Survey of Program Slicing Techniques", Journal of Programing Languages 3, 3 (1995), pp. 121-189. The combination of a program point and a set of variables of interest at that point is referred to as the slicing criterion. In particular, previous work on program slicing has focused on eliminating from a program those executable statements that are unnecessary with respect to the given slicing criterion.
However, a less obvious penalty of the use of class libraries in object oriented programming is that objects may contain unnecessary data members and subobjects. Larger objects can not only increase the space requirements of the program, but also decrease its execution speed, due to the extra time required for object construction and destruction, and the effects of paging and caching. The presence of unused or unnecessary data members and inheritance relations in a program has another disadvantage as well. It makes it unnecessarily more difficult for programmers to understand the code.